3.88 \(\int \frac{x^2 (A+B x+C x^2+D x^3)}{a+b x^2} \, dx\)

Optimal. Leaf size=111 \[ \frac{x (A b-a C)}{b^2}-\frac{\sqrt{a} (A b-a C) \tan ^{-1}\left (\frac{\sqrt{b} x}{\sqrt{a}}\right )}{b^{5/2}}+\frac{x^2 (b B-a D)}{2 b^2}-\frac{a (b B-a D) \log \left (a+b x^2\right )}{2 b^3}+\frac{C x^3}{3 b}+\frac{D x^4}{4 b} \]

[Out]

((A*b - a*C)*x)/b^2 + ((b*B - a*D)*x^2)/(2*b^2) + (C*x^3)/(3*b) + (D*x^4)/(4*b) - (Sqrt[a]*(A*b - a*C)*ArcTan[
(Sqrt[b]*x)/Sqrt[a]])/b^(5/2) - (a*(b*B - a*D)*Log[a + b*x^2])/(2*b^3)

________________________________________________________________________________________

Rubi [A]  time = 0.113119, antiderivative size = 111, normalized size of antiderivative = 1., number of steps used = 5, number of rules used = 4, integrand size = 28, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.143, Rules used = {1802, 635, 205, 260} \[ \frac{x (A b-a C)}{b^2}-\frac{\sqrt{a} (A b-a C) \tan ^{-1}\left (\frac{\sqrt{b} x}{\sqrt{a}}\right )}{b^{5/2}}+\frac{x^2 (b B-a D)}{2 b^2}-\frac{a (b B-a D) \log \left (a+b x^2\right )}{2 b^3}+\frac{C x^3}{3 b}+\frac{D x^4}{4 b} \]

Antiderivative was successfully verified.

[In]

Int[(x^2*(A + B*x + C*x^2 + D*x^3))/(a + b*x^2),x]

[Out]

((A*b - a*C)*x)/b^2 + ((b*B - a*D)*x^2)/(2*b^2) + (C*x^3)/(3*b) + (D*x^4)/(4*b) - (Sqrt[a]*(A*b - a*C)*ArcTan[
(Sqrt[b]*x)/Sqrt[a]])/b^(5/2) - (a*(b*B - a*D)*Log[a + b*x^2])/(2*b^3)

Rule 1802

Int[(Pq_)*((c_.)*(x_))^(m_.)*((a_) + (b_.)*(x_)^2)^(p_.), x_Symbol] :> Int[ExpandIntegrand[(c*x)^m*Pq*(a + b*x
^2)^p, x], x] /; FreeQ[{a, b, c, m}, x] && PolyQ[Pq, x] && IGtQ[p, -2]

Rule 635

Int[((d_) + (e_.)*(x_))/((a_) + (c_.)*(x_)^2), x_Symbol] :> Dist[d, Int[1/(a + c*x^2), x], x] + Dist[e, Int[x/
(a + c*x^2), x], x] /; FreeQ[{a, c, d, e}, x] &&  !NiceSqrtQ[-(a*c)]

Rule 205

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(Rt[a/b, 2]*ArcTan[x/Rt[a/b, 2]])/a, x] /; FreeQ[{a, b}, x]
&& PosQ[a/b]

Rule 260

Int[(x_)^(m_.)/((a_) + (b_.)*(x_)^(n_)), x_Symbol] :> Simp[Log[RemoveContent[a + b*x^n, x]]/(b*n), x] /; FreeQ
[{a, b, m, n}, x] && EqQ[m, n - 1]

Rubi steps

\begin{align*} \int \frac{x^2 \left (A+B x+C x^2+D x^3\right )}{a+b x^2} \, dx &=\int \left (\frac{A b-a C}{b^2}+\frac{(b B-a D) x}{b^2}+\frac{C x^2}{b}+\frac{D x^3}{b}-\frac{a (A b-a C)+a (b B-a D) x}{b^2 \left (a+b x^2\right )}\right ) \, dx\\ &=\frac{(A b-a C) x}{b^2}+\frac{(b B-a D) x^2}{2 b^2}+\frac{C x^3}{3 b}+\frac{D x^4}{4 b}-\frac{\int \frac{a (A b-a C)+a (b B-a D) x}{a+b x^2} \, dx}{b^2}\\ &=\frac{(A b-a C) x}{b^2}+\frac{(b B-a D) x^2}{2 b^2}+\frac{C x^3}{3 b}+\frac{D x^4}{4 b}-\frac{(a (A b-a C)) \int \frac{1}{a+b x^2} \, dx}{b^2}-\frac{(a (b B-a D)) \int \frac{x}{a+b x^2} \, dx}{b^2}\\ &=\frac{(A b-a C) x}{b^2}+\frac{(b B-a D) x^2}{2 b^2}+\frac{C x^3}{3 b}+\frac{D x^4}{4 b}-\frac{\sqrt{a} (A b-a C) \tan ^{-1}\left (\frac{\sqrt{b} x}{\sqrt{a}}\right )}{b^{5/2}}-\frac{a (b B-a D) \log \left (a+b x^2\right )}{2 b^3}\\ \end{align*}

Mathematica [A]  time = 0.0525082, size = 95, normalized size = 0.86 \[ \frac{b x \left (-6 a (2 C+D x)+12 A b+b x \left (6 B+4 C x+3 D x^2\right )\right )+12 \sqrt{a} \sqrt{b} (a C-A b) \tan ^{-1}\left (\frac{\sqrt{b} x}{\sqrt{a}}\right )+6 a (a D-b B) \log \left (a+b x^2\right )}{12 b^3} \]

Antiderivative was successfully verified.

[In]

Integrate[(x^2*(A + B*x + C*x^2 + D*x^3))/(a + b*x^2),x]

[Out]

(b*x*(12*A*b - 6*a*(2*C + D*x) + b*x*(6*B + 4*C*x + 3*D*x^2)) + 12*Sqrt[a]*Sqrt[b]*(-(A*b) + a*C)*ArcTan[(Sqrt
[b]*x)/Sqrt[a]] + 6*a*(-(b*B) + a*D)*Log[a + b*x^2])/(12*b^3)

________________________________________________________________________________________

Maple [A]  time = 0.004, size = 128, normalized size = 1.2 \begin{align*}{\frac{D{x}^{4}}{4\,b}}+{\frac{C{x}^{3}}{3\,b}}+{\frac{B{x}^{2}}{2\,b}}-{\frac{D{x}^{2}a}{2\,{b}^{2}}}+{\frac{Ax}{b}}-{\frac{aCx}{{b}^{2}}}-{\frac{a\ln \left ( b{x}^{2}+a \right ) B}{2\,{b}^{2}}}+{\frac{{a}^{2}\ln \left ( b{x}^{2}+a \right ) D}{2\,{b}^{3}}}-{\frac{aA}{b}\arctan \left ({bx{\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}}+{\frac{{a}^{2}C}{{b}^{2}}\arctan \left ({bx{\frac{1}{\sqrt{ab}}}} \right ){\frac{1}{\sqrt{ab}}}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(x^2*(D*x^3+C*x^2+B*x+A)/(b*x^2+a),x)

[Out]

1/4*D*x^4/b+1/3*C*x^3/b+1/2/b*B*x^2-1/2/b^2*D*x^2*a+1/b*A*x-1/b^2*a*C*x-1/2*a/b^2*ln(b*x^2+a)*B+1/2*a^2/b^3*ln
(b*x^2+a)*D-a/b/(a*b)^(1/2)*arctan(b*x/(a*b)^(1/2))*A+a^2/b^2/(a*b)^(1/2)*arctan(b*x/(a*b)^(1/2))*C

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(D*x^3+C*x^2+B*x+A)/(b*x^2+a),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: UnboundLocalError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(D*x^3+C*x^2+B*x+A)/(b*x^2+a),x, algorithm="fricas")

[Out]

Exception raised: UnboundLocalError

________________________________________________________________________________________

Sympy [B]  time = 1.03254, size = 243, normalized size = 2.19 \begin{align*} \frac{C x^{3}}{3 b} + \frac{D x^{4}}{4 b} + \left (\frac{a \left (- B b + D a\right )}{2 b^{3}} - \frac{\sqrt{- a b^{7}} \left (- A b + C a\right )}{2 b^{6}}\right ) \log{\left (x + \frac{B a b - D a^{2} + 2 b^{3} \left (\frac{a \left (- B b + D a\right )}{2 b^{3}} - \frac{\sqrt{- a b^{7}} \left (- A b + C a\right )}{2 b^{6}}\right )}{- A b^{2} + C a b} \right )} + \left (\frac{a \left (- B b + D a\right )}{2 b^{3}} + \frac{\sqrt{- a b^{7}} \left (- A b + C a\right )}{2 b^{6}}\right ) \log{\left (x + \frac{B a b - D a^{2} + 2 b^{3} \left (\frac{a \left (- B b + D a\right )}{2 b^{3}} + \frac{\sqrt{- a b^{7}} \left (- A b + C a\right )}{2 b^{6}}\right )}{- A b^{2} + C a b} \right )} - \frac{x^{2} \left (- B b + D a\right )}{2 b^{2}} - \frac{x \left (- A b + C a\right )}{b^{2}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x**2*(D*x**3+C*x**2+B*x+A)/(b*x**2+a),x)

[Out]

C*x**3/(3*b) + D*x**4/(4*b) + (a*(-B*b + D*a)/(2*b**3) - sqrt(-a*b**7)*(-A*b + C*a)/(2*b**6))*log(x + (B*a*b -
 D*a**2 + 2*b**3*(a*(-B*b + D*a)/(2*b**3) - sqrt(-a*b**7)*(-A*b + C*a)/(2*b**6)))/(-A*b**2 + C*a*b)) + (a*(-B*
b + D*a)/(2*b**3) + sqrt(-a*b**7)*(-A*b + C*a)/(2*b**6))*log(x + (B*a*b - D*a**2 + 2*b**3*(a*(-B*b + D*a)/(2*b
**3) + sqrt(-a*b**7)*(-A*b + C*a)/(2*b**6)))/(-A*b**2 + C*a*b)) - x**2*(-B*b + D*a)/(2*b**2) - x*(-A*b + C*a)/
b**2

________________________________________________________________________________________

Giac [A]  time = 1.18293, size = 151, normalized size = 1.36 \begin{align*} \frac{{\left (C a^{2} - A a b\right )} \arctan \left (\frac{b x}{\sqrt{a b}}\right )}{\sqrt{a b} b^{2}} + \frac{{\left (D a^{2} - B a b\right )} \log \left (b x^{2} + a\right )}{2 \, b^{3}} + \frac{3 \, D b^{3} x^{4} + 4 \, C b^{3} x^{3} - 6 \, D a b^{2} x^{2} + 6 \, B b^{3} x^{2} - 12 \, C a b^{2} x + 12 \, A b^{3} x}{12 \, b^{4}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(x^2*(D*x^3+C*x^2+B*x+A)/(b*x^2+a),x, algorithm="giac")

[Out]

(C*a^2 - A*a*b)*arctan(b*x/sqrt(a*b))/(sqrt(a*b)*b^2) + 1/2*(D*a^2 - B*a*b)*log(b*x^2 + a)/b^3 + 1/12*(3*D*b^3
*x^4 + 4*C*b^3*x^3 - 6*D*a*b^2*x^2 + 6*B*b^3*x^2 - 12*C*a*b^2*x + 12*A*b^3*x)/b^4